<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script>

            function f1(){
                //[0,1) 0  0.999999
                console.log(Math.random());

                //[a,b]之间的随机整数

                //[0,9]
                console.log(parseInt(Math.random()*10)+0);

                //[2,11]
                console.log(parseInt(Math.random()*10)+2);

                //parseInt(Math.random()*(b-a+1))+a
            }

        </script>
    </head>
    <body onload="f1();">

    </body>
</html>